package tedu.api.io;

import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.Scanner;

public class TestNote {
    public static void main(String[] args) throws IOException {
        FileOutputStream fos = new FileOutputStream("note.txt");
        Scanner scan = new Scanner(System.in);
        System.out.println("记事本已启动(单独输入exit退出)：");
        while(true){
            String line = scan.nextLine();
            if("exit".equalsIgnoreCase(line.trim())){
                System.out.println("正在退出");
                break;
            }
            line = line+"\n";
            fos.write(line.getBytes(StandardCharsets.UTF_8));
        }
        fos.close();
    }
}
